home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Internet Info 1994 March
/
Internet Info CD-ROM (Walnut Creek) (March 1994).iso
/
networking
/
ip
/
ka9q
/
src.arc
/
TCPTIMER.C
< prev
next >
Wrap
C/C++ Source or Header
|
1989-08-11
|
1KB
|
48 lines
/* TCP timeout routines */
#include <stdio.h>
#include "global.h"
#include "mbuf.h"
#include "timer.h"
#include "netuser.h"
#include "internet.h"
#include "tcp.h"
/* Timer timeout */
void
tcp_timeout(p)
void *p;
{
register struct tcb *tcb;
tcb = p;
if(tcb == NULLTCB)
return;
/* Make sure the timer has stopped (we might have been kicked) */
stop_timer(&tcb->timer);
switch(tcb->state){
case TIME_WAIT: /* 2MSL timer has expired */
close_self(tcb,NORMAL);
break;
default: /* Retransmission timer has expired */
tcb->flags.retran = 1; /* Indicate > 1 transmission */
tcb->backoff++;
tcb->snd.ptr = tcb->snd.una;
/* Reduce slowstart threshold to half current window */
tcb->ssthresh = tcb->cwind / 2;
tcb->ssthresh = max(tcb->ssthresh,tcb->mss);
/* Shrink congestion window to 1 packet */
tcb->cwind = tcb->mss;
tcp_output(tcb);
}
}
/* Backoff function - the subject of much research */
int
backoff(n)
int n;
{
return 1 << n; /* Binary exponential back off */
}